import "./index.css";
import Video from "./Video";
import { Link } from "react-router-dom";
import React, { Component, useRef } from "react";

export default function Search(props) {
  const { setSearch } = props;
  const inputRef = useRef();

  const handleSearch = () => {
    const keyCode=Event
    if (inputRef.current.value !== "") {
      setSearch(true);
    } else if (inputRef.current.value === "") {
      setSearch(false);
    }
  };

  return (
    <div>
      <div className="search">
        <div className="search-context">
          <h1>视频中心</h1>
          <h3>帮您快速了解汉得产品，助力交付使用全流程</h3>
          <input
            type="text"
            id="txt"
            placeholder="请搜索类别/视频名称"
            ref={inputRef}
            onKeyDown={handleSearch}
          />
          <button id="btn" onClick={handleSearch}>
            搜索
          </button>
          <ul id="list"></ul>
        </div>
      </div>
    </div>
  );
}
